package com.party.core.model.system;

import com.google.common.collect.Maps;
import com.google.common.collect.Sets;

import java.util.Map;
import java.util.Set;

/**
 * 业务类型枚举
 */
public enum TargetType {
    COURSE("COURSE", "课程"), // 众筹

    ZC_ACTIVITY("ZC_ACTIVITY", "众筹"), // 众筹

    ACTIVITY("ACTIVITY", "活动"), // 活动

    GOODS("GOODS", "玩法"), // 玩法

    DYNAMIC("DYNAMIC", "动态"), // 动态

    AD("AD", "广告"), // 广告

    SIGN("SIGN", "打卡"), // 打卡

    ARTICLE("ARTICLE", "文章"), // 文章

    COMPETITION("COMPETITION", "赛事"), // 赛事

    GATHER_FORM("GATHER_FORM", "自定义表单"), // 自定义表单

    GATHER_INFO("GATHER_INFO", "人员信息收集"), // 人员信息收集

    HELP("HELP", "帮助文档"), // 帮助文档

    MALL("MALL", "商城"), // 商城

    PACKAGE("PACKAGE", "套餐"), // 套餐

    CHANNEL("CHANNEL", "频道"), // 频道

    RESOURCE("RESOURCE", "资源"), // 资源

    SUBJECT("SUBJECT", "专题"), // 专题

    MERCHANT("MERCHANT", "商户"), // 商户

    GIFT("GIFT", "礼包"), // 礼包

    COUPON("COUPON", "卷码"), // 卷码

    CIRCLE("CIRCLE", "圈子"), // 圈子

    PUSH_SMS("PUSH_SMS", "短信"), // 短信

    PUSH_EMAIL("PUSH_EMAIL", "邮件"), // 邮件

    LOGO("LOGO", "用户头像"), // 用户头像

    QRCODE("QRCODE", "二维码"), // 二维码

    PHOTO("PHOTO", "相册照片"), // 相册照片

    PHOTO_POSTER("PHOTO_POSTER", "相册海报"),// 相册海报

    FINALPAYMENT("FINALPAYMENT","尾款提现"), //尾款提现

    ZC_P_POSTER("ZC_P_POSTER", "众筹者海报"),// 相册海报
    MEDAL("MEDAL", "奖牌"), // 奖牌
    MATERIAL("MATERIAL", "素材"), // 素材
    MOMENT("MOMENT", "行知公社动态"), // 行知公社动态
    INFORMATION("INFORMATION", "资讯"); // 行知公社动态
    //状态码
    private String code;

    //状态值
    private String value;

    TargetType(String code, String value) {
        this.code = code;
        this.value = value;
    }

    /**
     * 根据状态码获取状态值
     *
     * @param code 状态码
     * @return 状态值
     */
    public static String getValue(String code) {
        for (TargetType GiftTargetType : TargetType.values()) {
            if (GiftTargetType.getCode().equals(code)) {
                return GiftTargetType.getValue();
            }
        }
        return null;
    }


    /**
     * 枚举类型转换为map
     *
     * @return 转换后的map
     */
    public static Map<String, String> convertMap() {
        Map<String, String> map = Maps.newHashMap();
        for (TargetType GiftTargetType : TargetType.values()) {
            map.put(GiftTargetType.getCode(), GiftTargetType.getValue());
        }
        return map;
    }

    /**
     * 枚举code转为set
     * @return
     */
    public static Set<String> convertSet() {
        Set<String> set = Sets.newHashSet();
        for (TargetType type : TargetType.values()) {
            set.add(type.getCode());
        }
        return set;
    }


    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }
}
